package cn.zmit.kuxi.activity;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.xdroid.common.utils.ToastUtils;

import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import cn.zmit.kuxi.R;
import cn.zmit.kuxi.contants.Url;
import cn.zmit.kuxi.request.RequestTask;

/** * @author chenxu @parameter * @return */
public class ImagTextDetailsActivity extends BaseActivity {
	@ViewInject(R.id.webView1)
	private WebView webView1;
	private String gp_id, title, goodsName, allNeed, joinCount, description;
	private double progress;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setTitleView("图文详情", true);
		setContentView(R.layout.activity_image_text_details);
		ViewUtils.inject(this);

		initView();
	}

	private void initView() {//加载图文网页
		gp_id = getTextFromBundle("gp_id");
		title = getTextFromBundle("title");
		goodsName = getTextFromBundle("goodsName");
		allNeed = getTextFromBundle("allNeed");
		joinCount = getTextFromBundle("joinCount");
		progress = getDoubleFromBundle("progress");
		description = getTextFromBundle("description");
//		ToastUtils.show(context, "gp_id:" + gp_id);
		String url = Url.IMAGETEXT + "?gp_id=" + gp_id;
		/**
		 * 一下让网页适应屏幕
		 */
//		WebSettings set = webView1.getSettings();

		// 让网页自适应屏幕宽度
		WebSettings webSettings= webView1.getSettings();
		webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
//		int screenDensity = getResources().getDisplayMetrics().densityDpi ;  
//		WebSettings.ZoomDensity zoomDensity = WebSettings.ZoomDensity.MEDIUM ; 
//		switch (screenDensity){   
//		case DisplayMetrics.DENSITY_LOW :  
//		    zoomDensity = WebSettings.ZoomDensity.CLOSE;  
//		    break;  
//		case DisplayMetrics.DENSITY_MEDIUM:  
//		    zoomDensity = WebSettings.ZoomDensity.MEDIUM;  
//		    break;  
//		case DisplayMetrics.DENSITY_HIGH:  
//		    zoomDensity = WebSettings.ZoomDensity.FAR;  
//		    break ;
//		}
//		webSettings.setDefaultZoom(zoomDensity);
		webSettings.setBuiltInZoomControls(false);// 设置是否显示缩放工具
//		set.setUseWideViewPort(true);
//		set.setLoadWithOverviewMode(true);
		webView1.loadUrl(url);
	}


}
